﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 	
    xmlns:Windows="clr-namespace:System.Windows;assembly=System.Windows.Controls" 
    xmlns:LayerPanel="clr-namespace:SMIL.Client.WPXAP.LayerPanel"
    xmlns:Converters="clr-namespace:DeepEarth.BingMapsToolkit.Client.Common.Converters;assembly=DeepEarth.BingMapsToolkit.Client.Common.Converters">

	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="/DeepEarth.BingMapsToolkit.Client.Common;component/Resources/CommonStyles.xaml" />
	</ResourceDictionary.MergedDictionaries>

	<!--TreeView-->
	<Style TargetType="LayerPanel:LayerPanel">
        <Setter Property="BorderBrush" Value="Black"/>
        <Setter Property="Background" Value="#FF2B2B2B"/>
        <Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="LayerPanel:LayerPanel">
					<Grid x:Name="LayoutRoot" Width="276" Opacity="0.82">
						<vsm:VisualStateManager.VisualStateGroups>
							<vsm:VisualStateGroup x:Name="CommonStates">
								<vsm:VisualStateGroup.Transitions>
									<vsm:VisualTransition GeneratedDuration="00:00:00.3000000"/>
								</vsm:VisualStateGroup.Transitions>
								<vsm:VisualState x:Name="MouseOver">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.Opacity)">
											<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</vsm:VisualState>
								<vsm:VisualState x:Name="Normal">
									<Storyboard/>
								</vsm:VisualState>
							</vsm:VisualStateGroup>
						</vsm:VisualStateManager.VisualStateGroups>
						<Grid.Resources>
							<Converters:VisibilityConverter x:Key="VisibilityConverter" />
							<Windows:HierarchicalDataTemplate x:Key="LayerTemplate" ItemsSource="{Binding Layers}">
								<Grid HorizontalAlignment="Stretch">
									<StackPanel Orientation="Horizontal">
										<Image Source="{Binding Path=IconURI}" HorizontalAlignment="Left" Height="15" Stretch="UniformToFill" Visibility="{Binding Path=IconURI, Converter={StaticResource VisibilityConverter}}" />
										<TextBlock Margin="5,0,0,0" HorizontalAlignment="Left" Foreground="White" Text="{Binding Path=LayerAlias}" Width="120" TextWrapping="NoWrap" ></TextBlock>
									</StackPanel>
									<CheckBox Margin="0,0,22,0" HorizontalAlignment="Right" Foreground="White" IsChecked="{Binding Path=Selected, Mode=TwoWay}" />
									<!--<CheckBox Margin="0,0,2,0" HorizontalAlignment="Right" Foreground="White" IsChecked="{Binding Path=LabelOn, Mode=TwoWay}"/>-->
								</Grid>
							</Windows:HierarchicalDataTemplate >
						</Grid.Resources>
						<Border HorizontalAlignment="Stretch" Margin="5,0,5,0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,1">
							<ScrollViewer VerticalScrollBarVisibility="Auto" Style="{StaticResource ScrollViewerStyle}">
								<StackPanel x:Name="SidePanel" HorizontalAlignment="Stretch">
									<ContentPresenter x:Name="PART_AdditionalContent" Content="{TemplateBinding Content}" />
									<Grid HorizontalAlignment="Stretch">
										<Button x:Name="PART_ToggleLayers" HorizontalAlignment="Right" Margin="0,0,28,0" ToolTipService.ToolTip="Toggle Layer" Style="{StaticResource ButtonStyle}">
											<Image Width="14" Source="/DeepEarth.BingMapsToolkit.Client.Controls.LayerPanel;component/Images/layer.png"></Image>
										</Button>
										<!--<Button x:Name="PART_ToggleLabels" HorizontalAlignment="Right" Margin="0,0,8,0" ToolTipService.ToolTip="Toggle Label" Style="{StaticResource ButtonStyle}">
											<Image Width="14" Source="/DeepEarth.BingMapsToolkit.Client.Controls.LayerPanel;component/Images/label.png"></Image>
										</Button>-->
									</Grid>
									<Controls:TreeView x:Name="PART_LayerTreeview" ItemTemplate="{StaticResource LayerTemplate}" Style="{StaticResource LayerTreeViewStyle}" ItemContainerStyle="{StaticResource LayerTreeViewItemStyle}" />
								</StackPanel>
							</ScrollViewer>
						</Border>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<!--Accordion-
	<Style TargetType="LayerPanel:AccordionLayerPanel">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="LayerPanel:AccordionLayerPanel">
					<Grid x:Name="LayoutRoot" Opacity="0.82">
						<vsm:VisualStateManager.VisualStateGroups>
							<vsm:VisualStateGroup x:Name="CommonStates">
								<vsm:VisualStateGroup.Transitions>
									<vsm:VisualTransition GeneratedDuration="00:00:00.3000000"/>
								</vsm:VisualStateGroup.Transitions>
								<vsm:VisualState x:Name="MouseOver">
									<Storyboard>
										<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.Opacity)">
											<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
										</DoubleAnimationUsingKeyFrames>
									</Storyboard>
								</vsm:VisualState>
								<vsm:VisualState x:Name="Normal">
									<Storyboard/>
								</vsm:VisualState>
							</vsm:VisualStateGroup>
						</vsm:VisualStateManager.VisualStateGroups>
						<Grid.Resources>
							<DataTemplate x:Key="AccordionLayerTemplate">
								<Grid HorizontalAlignment="Left" Height="20" Width="auto" >
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="150"/>
										<ColumnDefinition Width="*"/>
									</Grid.ColumnDefinitions>
									<TextBlock Foreground="White" Grid.Column="0" Text="{Binding Name}" HorizontalAlignment="Left" DataContext="{Binding BindsDirectlyToSource=True}" />
									<ToggleButton Grid.Column="1" Style="{StaticResource ToggleButtonStyle}" HorizontalAlignment="Left" DataContext="{Binding BindsDirectlyToSource=True}" IsChecked="{Binding Path=Selected, Mode=TwoWay}">
										<Image Width="14" Source="/DeepEarth.BingMapsToolkit.Client.Controls.LayerPanel;component/Images/layer.png"></Image>
									</ToggleButton>
								</Grid>
							</DataTemplate>
							<DataTemplate x:Key="AccordionItemLayerTemplate">
								<StackPanel >
									<ItemsControl ItemsSource="{Binding Layers}">
										<ItemsControl.ItemTemplate>
											<DataTemplate>
												<Grid HorizontalAlignment="Stretch">
													<Grid.ColumnDefinitions>
														<ColumnDefinition Width="16"/>
														<ColumnDefinition Width="*"/>
														<ColumnDefinition Width="25"/>
														<ColumnDefinition Width="25"/>
														<ColumnDefinition Width="25"/>
													</Grid.ColumnDefinitions>
													<Image Source="{Binding Path=IconURI}" Grid.Column="0" HorizontalAlignment="Left" Height="15" Stretch="UniformToFill" Visibility="{Binding Path=IconURI, Converter={StaticResource VisibilityConverter}}" />
													<HyperlinkButton Grid.Column="1" Content="{Binding LayerAlias}" />
													<Button x:Name="LayerPanel_GotoButton" Grid.Column="2" DataContext="{Binding BindsDirectlyToSource=True}" Style="{StaticResource ButtonStyle}" >
														<Image Width="14" Source="/DeepEarth.BingMapsToolkit.Client.Controls.LayerPanel;component/Images/magnify.png"></Image>
													</Button>
													<ToggleButton Style="{StaticResource ToggleButtonStyle}" Grid.Column="3" DataContext="{Binding BindsDirectlyToSource=True}" IsChecked="{Binding Path=Selected, Mode=TwoWay}" >
														<Image Width="14" Source="/DeepEarth.BingMapsToolkit.Client.Controls.LayerPanel;component/Images/layer.png"></Image>
													</ToggleButton>
													<ToggleButton Style="{StaticResource ToggleButtonStyle}" Grid.Column="4" DataContext="{Binding BindsDirectlyToSource=True}" IsChecked="{Binding Path=LabelOn, Mode=TwoWay}" >
														<Image Width="14" Source="/DeepEarth.BingMapsToolkit.Client.Controls.LayerPanel;component/Images/label.png"></Image>
													</ToggleButton>
												</Grid>
											</DataTemplate>
										</ItemsControl.ItemTemplate>
									</ItemsControl>
								</StackPanel>
							</DataTemplate>
						</Grid.Resources>
						<Border HorizontalAlignment="Stretch" Margin="5,0,5,0" Background="#FF2B2B2B" BorderBrush="#FF000000" BorderThickness="1,1,1,1">
							<ScrollViewer VerticalScrollBarVisibility="Auto" Style="{StaticResource ScrollViewerStyle}">
								<StackPanel x:Name="SidePanel" HorizontalAlignment="Stretch">
									<LayoutToolkit:Accordion SelectionMode="ZeroOrMore" x:Name="PART_LayerAccordion" Style="{StaticResource AccordionStyle}" ItemContainerStyle="{StaticResource AccordionItemStyle}" ContentTemplate="{StaticResource AccordionItemLayerTemplate}" ItemTemplate="{StaticResource AccordionLayerTemplate}" />
									<ContentPresenter x:Name="PART_AdditionalContent" Content="{TemplateBinding Content}" />
								</StackPanel>
							</ScrollViewer>
						</Border>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>-->
</ResourceDictionary>
